Skip to content

Remove tolerant option from Semver#573

Merged
mxcl merged 2 commits into
pkgxdev:mainfrom
uesyn:remove-semver-tolerant
May 9, 2023
Merged

Remove tolerant option from Semver#573
mxcl merged 2 commits into
pkgxdev:mainfrom
uesyn:remove-semver-tolerant

Conversation

@uesyn
Copy link
Copy Markdown
Contributor

@uesyn uesyn commented May 7, 2023

Uploaded bottles versions are always checked with Semver with tolerant=true.
Therefore, CLI also has to accept SemVer objects with tolerant=true, I think it meens that tolerant option doesn't be needed.

This PR remove the tolerant option from SemVer.
I confirmed local tests are all passed and tmux=3.3a can be run.

test resulsts
$ deno task test
Task test deno test --allow-net --allow-read --allow-env --allow-run --allow-write --unstable
Check file:///home/uesyn/src/github.com/uesyn/cli/tests/functional/args.test.ts
Check file:///home/uesyn/src/github.com/uesyn/cli/tests/functional/devenv.test.ts
Check file:///home/uesyn/src/github.com/uesyn/cli/tests/functional/exec.test.ts
Check file:///home/uesyn/src/github.com/uesyn/cli/tests/functional/magic.test.ts
Check file:///home/uesyn/src/github.com/uesyn/cli/tests/functional/provides.test.ts
Check file:///home/uesyn/src/github.com/uesyn/cli/tests/functional/repl.test.ts

...

<<----------------------------------------------------- attachment end
----- output end -----
  normal error ... ok (4ms)
useErrorHandler ... ok (20ms)
useErrorHandler silent ...
  normal error ... ok (4ms)
useErrorHandler silent ... ok (8ms)
running 6 tests from ./tests/unit/utils.test.ts
validate string ... ok (5ms)
validate array ... ok (2ms)
flatmap ... ok (3ms)
async flatmap ... ok (3ms)
chuzzle ... ok (3ms)
panic ... ok (4ms)
                                                                                                                                                                                              
ok | 53 passed (159 steps) | 0 failed (2m35s)
tmux
$ export TEA_PREFIX=${HOME}/.tea
$ rm -rf $TEA_PREFIX                                                                                                                                                                          $ ./tea --version
tea 0.31.2+dev                                                                                                                                                                                  
$ ./tea -S
pantries sync’d ⎷
tea: empty pkg env
$ ./tea +github.com/tmux/tmux=3.3a tmux -V                                                                                                                                                   installed: ~/.tea/curl.se/ca-certs/v2023.1.10
installed: ~/.tea/openssl.org/v1.1.1t
installed: ~/.tea/libevent.org/v2.1.12
installed: ~/.tea/invisible-island.net/ncurses/v6.4.0
installed: ~/.tea/github.com/tmux/tmux/v3.3a
tmux 3.3a 

fix: #572

@what-the-diff
Copy link
Copy Markdown

what-the-diff Bot commented May 7, 2023

PR Summary

  • Constructor of SemVer class now accepts string input
    The SemVer class has been updated to take a string as input, making it more convenient to use.
  • Parse function returns undefined for improper version numbers
    The parse function in the semver module has been improved to return undefined if a given version number cannot be parsed, rather than throwing an error. This helps with better error handling.
  • Improved parsing of "~" operator in Range class
    The Range class now correctly parses the "~" operator (e.g., ~1) to return an array of versions [v1, v2], where v2 is calculated as the next major version after v1. This helps in handling version ranges more efficiently.

@coveralls
Copy link
Copy Markdown

coveralls commented May 7, 2023

Coverage Status

Coverage: 77.198% (+0.09%) from 77.103% when pulling 74b550d on uesyn:remove-semver-tolerant into 31c2fc0 on teaxyz:main.

@jhheider jhheider linked an issue May 7, 2023 that may be closed by this pull request
@jhheider jhheider requested a review from mxcl May 8, 2023 19:01
@mxcl
Copy link
Copy Markdown
Contributor

mxcl commented May 9, 2023

k i think this is safe. The main reason for being tolerant here before was we parsed versions out of junk like foo 3 bar and that shouldn't really become a v3. But now we insist the strings are confined to the version and you have to strip out the junk. Will review a bit more then merge. Thanks!

@mxcl mxcl merged commit 38304b4 into pkgxdev:main May 9, 2023
@mxcl
Copy link
Copy Markdown
Contributor

mxcl commented May 9, 2023

/cc @ABevier

@uesyn uesyn deleted the remove-semver-tolerant branch May 9, 2023 17:19
@coveralls
Copy link
Copy Markdown

Coverage Status

Changes unknown
when pulling 86334f5 on uesyn:remove-semver-tolerant
into ** on teaxyz:main**.

@jhheider
Copy link
Copy Markdown
Contributor

801 days. Solid, automated necroing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

semver.ts needs tweaks for "short" versions Unable to run tmux

4 participants